# -*- coding: utf-8 -*-
# @Time    : 2024/9/11 下午8:58
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : shell.py
# @Software: PyCharm

"""
封装shell命令
"""

import subprocess

class Shell:
    @staticmethod
    def execute(cmd):
        output,errors = subprocess.Popen (cmd, shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()
        out_msg = output.decode("gbk")
        return out_msg


if __name__ == '__main__':
    cmd="dir"
    msg=Shell.execute(cmd)
    print(msg)
